python check for int

26

'16'.isdigit()
>>>True

'3.14'.isdigit()
>>>False

'Some text'.isdigit()
>>>False
str = input("Enter any value: ")
 
if str.isdigit():
    print("User input is an Integer ")
else:
    print("User input is string ")

Comments

Submit
0 Comments